package com.zmx.patientend.listener;

import android.content.Context;

/**
 * 程序猿：胖胖祥
 * 时 间：2020/9/3  22:56
 * 功 能：
 */
public class InformUpdateListenerManager {

    private MessageUpdateListener messageUpdateListener;
    private Context mContext;
    private static InformUpdateListenerManager manager;

    public static InformUpdateListenerManager getInstance(Context context){
        if(manager==null){
            manager = new InformUpdateListenerManager(context);

        }
        return manager;
    }
    public InformUpdateListenerManager(Context context){
        this.mContext =context.getApplicationContext();//使用getAppcationContext()防止单例模式内存泄漏
    }
    public void setInformUpdateListener(MessageUpdateListener informUpdateListener) {
        this.messageUpdateListener = informUpdateListener;
    }

    public void updateData() {
        if (messageUpdateListener != null) {
            messageUpdateListener.updateMessage();
        }
    }
}

